package com.changgou.order.dao;

import com.changgou.order.pojo.OrderItem;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface OrderItemMapper extends Mapper<OrderItem> {

    @Select("select category_id3,SUM(money) total from tb_order_item where order_id in \n" +
            "(select id from tb_order where create_time BETWEEN \n" +
            "date_sub(curdate(),interval 1 day) and CURDATE()) GROUP BY category_id3")
    public List<Map> getOrderItemByCategory3();

    @Select("select category_id3,SUM(money) total,t3.order_status from tb_order_item,(select order_status,id from tb_order) t3 where order_id in \n" +
            "(select id from tb_order where create_time BETWEEN \n" +
            "date_sub(curdate(),interval 1 day) and CURDATE()) and order_id =t3.id  GROUP BY category_id3,t3.order_status; \n"
            )
    public List<Map> getOrderItemByCategory3AndOrderStatus();
}
